package data;

import java.util.ArrayList;
import java.util.List;

public class Text_to_Data {
	
	//Given a file, return an ArrayList<DataPoint>
	public static List<DataPoint> text_to_data(String file){
		boolean keepGoing=true; //for while loop
		
		//Tokenize the data file into an ArrayList of datapoints
		TextTokenizer tft = new TextTokenizer(file);
		DataPoint dp; //just a place holder
		List<DataPoint> al = new ArrayList<DataPoint>();
		
		//empty the Tokenizer list for the data file
		while(keepGoing){
			dp=tft.getNextPoint();
			if(dp==null){
				keepGoing=false;
			}
			else{
				al.add(dp); //add to ArrayList
			}
		}
		
		return al;//done, so return
	}
}
